package com.itheima.map.mapdemo;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MyMap3 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("一号丈夫", "一号妻子");
        map.put("二号丈夫", "二号妻子");

        //
//        Set<String> set = map.keySet();
//        for (String key : set) {
//            String value = map.get(key);
//            System.out.println(key+"-------"+value);
//        }

        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "-----" + value);
        }
    }

}
